package com.hs.server.task;

import com.hs.server.mapper.ShResourcexxMapper;
import com.hs.server.mapper.VehZnshinfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ScheduledTask {
    @Autowired
    private VehZnshinfoMapper vehZnshinfoMapper;
    @Autowired
    private ShResourcexxMapper shResourcexxMapper;
    /**
     * 定时重置当天的异常数据
     */
    @Scheduled(cron = "0 0/15 8-19 * * ?")//在每天早上8点到下午19点期间的每5分钟触发
    void resetYcdata(){
        log.info("【15分钟定时重置当天的异常数据】");
        vehZnshinfoMapper.resetYcdata();
    }


    /**
     * 定时检查服务器资源状态
     */
    @Scheduled(cron = "0 0/15 8-19 * * ?")//在每天早上8点到下午19点期间的每5分钟触发
    void resetResource(){
        int i = shResourcexxMapper.resetResource();
        log.info("【15分钟定时检查重置服务器资源状态】更新行数：" + i);
    }
}
